<?php

class QuerySql_model extends Model
{

	function __construct(){
		parent::__construct();
	}

	public function xhrExecuteQery($sql,$array)
	{
		$q = $this->db->prepare($sql);
		$q->execute($array);
		return $q->rowCount();
	}

	public function xhrExecuteQerySelect($sql,$array)
	{
		$q = $this->db->prepare($sql);
		$q->execute($array);
		return $q->fetchAll();
	}

	public function xhrCheckUser_fb($IdFacebook)
	{
		$q = $this->db->prepare("SELECT User_Id FROM users WHERE IdFacebook = :IdFacebook ");
		$q->execute(array(
			':IdFacebook' 	=> 	$IdFacebook,
		));
		// return array
		//$data = $q->fetchAll();
		$count = $q->rowCount();

		if($count != 0){
			return true;
		}else {
			return false;
		}
	}

	
}
?>